{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "90b9b361",
   "metadata": {},
   "source": [
    "---------------\n",
    "* 日期: 2022-11-23\\week14\n",
    "* 课程： python\n",
    "* 记录人：姚远航\n",
    "---------------\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a31486a8",
   "metadata": {},
   "source": [
    "# 1.函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "274f3fe6",
   "metadata": {},
   "outputs": [],
   "source": [
    "def greet_user():\n",
    "    \"\"\"用户问候语\"\"\"\n",
    "    print(\"hello world\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e39b117b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world\n"
     ]
    }
   ],
   "source": [
    "greet_user()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "665d4dec",
   "metadata": {},
   "outputs": [],
   "source": [
    "def greet_user(username):\n",
    "    \"\"\"用户问候语\"\"\"\n",
    "    print(\"hello\",username)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "40ea6a7a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello 李华\n"
     ]
    }
   ],
   "source": [
    " greet_user(username=\"李华\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a0d0c9f9",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 函数的意义 1：重复使用\n",
    "#            2：可以给了解python的人使用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f2a3ef01",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 实践：广州南方学院新闻网站url实践函数\n",
    "def NFU_NEWS_URL(分类,页码):\n",
    "    \"\"\"广州南方学院新闻网站url数据\n",
    "       分类包含：【学校要闻:xxyw,学院动态:xydt,通知公告:tzgg,招投标:ztb】\n",
    "       页码包含:【113，106，37，27】\n",
    "    \"\"\"\n",
    "    for i in range(页码):\n",
    "        print(\"https://www.nfu.edu.cn/\"+ 分类 + \"/index\"+str(i)+\".htm\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "aa535dbd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function NFU_NEWS_URL in module __main__:\n",
      "\n",
      "NFU_NEWS_URL(分类, 页码)\n",
      "    广州南方学院新闻网站url数据\n",
      "    分类包含：【学校要闻:xxyw,学院动态:xydt,通知公告:tzgg,招投标:ztb】\n",
      "    页码包含:【113，106，37，27】\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(NFU_NEWS_URL)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "27b5dfa9",
   "metadata": {},
   "source": [
    "# 2.模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "63925938",
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'colloge_url_crawl'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Input \u001b[1;32mIn [3]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mcolloge_url_crawl\u001b[39;00m\n",
      "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'colloge_url_crawl'"
     ]
    }
   ],
   "source": [
    "import colloge_url_crawl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c1130538",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
